package com.driver.model;



import java.util.List;
import java.util.Set;
import java.util.Map;
import java.sql.*;

import com.carstop.model.CarStopDetailVO;

public class CarDriverPathService {

	private CarDriverPathVO_interface dao;

	public CarDriverPathService() {
		dao = new CarDriverPathDAO();
	}

	public CarDriverPathVO addCarDriver(String driver_path_id, Integer distance, 
			Integer fee,Integer status,Integer maxrider,String member_id,String pool_type,String regular_id) {

		CarDriverPathVO cardriverVO = new CarDriverPathVO();

		cardriverVO.setDriver_path_id(driver_path_id);
		cardriverVO.setDistance(distance);
		cardriverVO.setFee(fee);
		cardriverVO.setStatus(status);
		cardriverVO.setMaxrider(maxrider);
		cardriverVO.setMember_id(member_id);
		cardriverVO.setPool_type(pool_type);
		cardriverVO.setRegular_id(regular_id);
		dao.insert(cardriverVO);

		return cardriverVO;
	}

	public CarDriverPathVO updateCarDriver(String driver_path_id, Integer distance, 
			Integer fee,Integer status,Integer maxrider,String member_id,String pool_type,String regular_id) {

		CarDriverPathVO cardriverVO = new CarDriverPathVO();

		cardriverVO.setDriver_path_id(driver_path_id);
		cardriverVO.setDistance(distance);
		cardriverVO.setFee(fee);
		cardriverVO.setStatus(status);
		cardriverVO.setMaxrider(maxrider);
		cardriverVO.setMember_id(member_id);
		cardriverVO.setPool_type(pool_type);
		cardriverVO.setRegular_id(regular_id);
		dao.update(cardriverVO);

		return cardriverVO;
	}

	public void deleteCarDriver(String Driver_path_id) {
		dao.delete(Driver_path_id);
	}

	public CarDriverPathVO getOneCarDriver(String Driver_path_id) {
		return dao.findByPrimaryKey(Driver_path_id);
	}

	public List<CarDriverPathVO> getAll() {
		return dao.getAll();
	}
	
	public List<CarDriverPathVO> getAllByMemberId(String memberId) {
		return dao.getAll(memberId);
	}
	
	public List<CarDriverPathVO> getAll(Map<String, String[]> map) {
		return dao.getAll(map);
	}
	public Set<CarStopDetailVO> getCarDriverDetailByPath(String driver_path_id) {
		return dao.getCarDriverDetailByPath(driver_path_id);
	}
	
	public List<CarDriverPathVO> suggestDriverPath(String riderPathId, int day, int distanceRange) {
		return dao.suggestDriverPath(riderPathId, day, distanceRange);
	}
	
	public List<Timestamp> getTimeInfo(String driverPathId) {
		return dao.getTimeInfo(driverPathId);
	}
}
